package com.dwy2002.enums;

import lombok.Getter;

/**
 * @author 杜伟毅
 * @version 1.0
 * @since 2025/03/02
 */
@Getter
public enum NumberEnum {
    ZERO(0),
    ONE(1),
    TWO(2),
    THREE(3),
    FOUR(4),
    FIVE(5);

    private final int value;

    NumberEnum(int value) {
        this.value = value;
    }

    // 通过数字反向获取枚举实例（可选）
    public static NumberEnum fromValue(int value) {
        for (NumberEnum number : NumberEnum.values()) {
            if (number.value == value) {
                return number;
            }
        }
        throw new IllegalArgumentException("无效的枚举值: " + value);
    }

    // 可选：覆盖toString()方法
    @Override
    public String toString() {
        return String.valueOf(value);
    }
}
